package com.hrms.domain;

import java.text.ParseException;
import java.util.Date;
import java.util.Map;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.hrms.core.Utils;

@PersistenceCapable(detachable="true")
public class DailyCell extends BusinessObjectImpl {
	public static final String TYPE = DailyCell.class.getSimpleName();

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	private Key taskKey; //Key Index of PI Reference Item
	
	@Persistent//Cell Date
	private Date date;
	
	@Persistent
	private String celldata;
	
	@Persistent
	private String userId;  // gae doesnt support joins with filter between dates so try equal wit user from task
	
	

	@Override
	public void jdoPreStore() {
		setCelldata(Utils.cleanedContent(celldata));
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public DailyCell() {
		super();
	}

	public DailyCell(Map<String, String[]> parameterMap, String prefix)
			throws IllegalArgumentException, IllegalAccessException,
			ParseException {
		super(parameterMap, prefix);
	}

	public DailyCell(Map<String, String[]> parameterMap)
			throws IllegalArgumentException, IllegalAccessException,
			ParseException {
		super(parameterMap);
	}

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}

	public Key getTaskKey() {
		return taskKey;
	}

	public void setTaskKey(Key taskKey) {
		this.taskKey = taskKey;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getCelldata() {
		return celldata;
	}

	public void setCelldata(String celldata) {
		this.celldata = celldata;
	}

}
